package string;
/*
    boolean contains(CharSequence s) : 判断调用方法的字符串对象是否包含传入的字符串对象
    CharSequence: 是String,StringBuilder,StringBuffered的父类型


 */

public class StringDemo2 {
    public static void main(String[] args) {
        //定义字符串对象
        String str = "HelloWorld";

        System.out.println("str.contains(\"Hello\") = " + str.contains("Hello"));
        System.out.println("str.contains(\"hello\") = " + str.contains("hello"));

        System.out.println("str.startsWith(\"He\") = " + str.startsWith("He"));
        System.out.println("str.endsWith(\"dd\") = " + str.endsWith("dd"));//false

        System.out.println("str.isEmpty() = " + str.isEmpty());//不是空字符串

    }
}
